using System;
using HCore.Core;

namespace HCore.Tests.Runtime.ShootingEditor2D.Scripts.System.GunSystem
{
    public enum GunState
    {
        /// <summary>
        ///     闲置
        /// </summary>
        Idle,

        /// <summary>
        ///     射击中
        /// </summary>
        Shooting,

        /// <summary>
        ///     装弹
        /// </summary>
        Reload,

        /// <summary>
        ///     切枪
        /// </summary>
        Shift,
        EmptyBullet,
        CoolDown
    }

    public class GunInfo : ICloneable
    {
        /// <summary>
        ///     当前枪中的子弹
        /// </summary>
        public readonly BindableProperty<int> BulletCountInGun = new(3);

        /// <summary>
        ///     后备子弹
        /// </summary>
        public readonly BindableProperty<int> BulletCountOutGun = new(1);

        /// <summary>
        ///     枪的状态
        /// </summary>
        public readonly BindableProperty<GunState> GunState = new();

        /// <summary>
        ///     枪名字
        /// </summary>
        public readonly BindableProperty<string> Name = new("手枪");

        public object Clone()
        {
            var newGun = new GunInfo();
            newGun.GunState.Value = GunState.Value;
            newGun.Name.Value = Name.Value;
            newGun.BulletCountInGun.Value = BulletCountInGun.Value;
            newGun.BulletCountOutGun.Value = BulletCountOutGun.Value;
            return newGun;
        }
    }
}